/**
 * @Author Weton Li
 * @Date 2021/3/29 14:02
 */
public class Main1 {

    public static int method(int[] nums, int x, int start, int end) {

//        int start = 0;
//        int end = nums.length;


//        while (start < end) {
//            int mid = (start+end)/2;
//            if (x < mid){
//
//            }
//        }
        if (start <= end) {
            int mid = (start + end) / 2;
            if (nums[mid] == x) {
                return mid;
            } else if (nums[mid] < x) {
                start = mid + 1;
            } else{
                end = mid - 1;
            }
            return method(nums, x, start, end);
        } else {
            return -1;
        }

    }

    public static void main(String[] args) {
        int[] nums = {1, 3, 5, 7, 9};// 9 11 13 15 17
        int index = method(nums, 3, 0, nums.length);
//        System.out.println(index);
//        System.out.println(nums[index]);

        String s = "1.select sname,city from s;\n" +
                "2.select pname,color,weight from p;\n" +
                "3.select jno from spj where sno=’s1’;\n" +
                "4.select pname,qty from p,spj where p.pno=spj.pno where spj.jno=’j2’;\n" +
                "5.select pno from s,spj where s.sno=spj.sno where s.city=’上海’;\n" +
                "6.\n" +
                "Select jname from j where jno in(Select jno from spj where sno in(select s.sno from s where s.city=’上海’));\n" +
                "7.select jno from spj where sno not in(select sno from s,spj where s.city=’天津’ and s.sno=spj.sno);\n" +
                "8.update p set color=’蓝’ where color=’红’;\n" +
                "9.update spj set sno=’s3’ where sno=’s5’ and jno=’j4’ and pno=’p6’;\n" +
                "10.delete from s where sno=’s2’;delete from spj where sno=’s2’;\n" +
                "11.insert into spj values(‘s2’,’j6’,’p4’,200);\n" +
                " create view v1 as (select sno,pno,jno,qty from s,spj where j.jname=’三建’ and j.jno=spj.jno);\n" +
                "(1) select pno,qty from v1;\n" +
                "(2)select * from v1 where sno=’s1’; \n";
        String s1 = s.toUpperCase();
        System.out.println(s1);
    }

}

//LOG.info("generateInfoNodeByCommands - success", e,
//        "TaskId", getTaskId(),
//        "meshName", meshName,
//        "cost", System.currentTimeMillis() - startOne);

